package com.huangyi.rabbitmq_spring.listener;

import com.huangyi.rabbitmq_spring.constants.Constants;
import com.huangyi.rabbitmq_spring.model.UserInfo;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class WorkListener {
//    @RabbitListener( queues = Constants.WORK_QUEUE )
//    public void workListener1(String message) {
//        System.out.println("队列["+Constants.WORK_QUEUE+"] 接收到消息:" + message);
//    }
//    @RabbitListener( queues = Constants.WORK_QUEUE )
//    public void workListener2(String message) {
//        System.out.println("队列["+Constants.WORK_QUEUE+"] 接收到消息:" + message);
//    }
//
//
    @RabbitListener( queues = Constants.WORK_QUEUE )
    @RabbitHandler
    public void workListener3(UserInfo userInfo) {
        System.out.println("队列["+Constants.WORK_QUEUE+"] 接收到消息:" + userInfo.toString());
    }

}
